const randomBlock = [
    [
        [0,1,0,0,],
        [0,1,0,0,],
        [0,1,0,0,],
        [0,1,0,0,],
    ],
    [
        [0,2,0,0],
        [0,2,0,0],
        [0,2,2,0],
        [0,0,0,0],
    ],
    [
        [0,0,3,0],
        [0,0,3,0],
        [0,3,3,0],
        [0,0,0,0],
    ],
    [
        [0,0,0,0],
        [0,4,4,0],
        [0,4,4,0],
        [0,0,0,0],
    ],
    [
        [0,5,0,0],
        [0,5,5,0],
        [0,0,5,0],
        [0,0,0,0],
    ],
    [
        [0,0,6,0],
        [0,6,6,0],
        [0,6,0,0],
        [0,0,0,0],
    ],
    [
        [0,0,0,0],
        [0,7,0,0],
        [7,7,7,0],
        [0,0,0,0],
    ],
]

const colorArr = [ '', 'red', 'greenyellow', 'green', 'blue', 'pink', 'purple', 'orange' ]

// 随机返回一种块
function getRandomBlock() {
    let len = randomBlock.length
    let index = Math.floor(Math.random()*len)  // [0, len] 向下取整
    return randomBlock[index]
}